package com.ruoyi.mapper;

import java.util.List;
import com.ruoyi.domain.ProApplicationPayment;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 付款申请单Mapper接口
 * 
 * @author ruoyi
 * @date 2020-06-23
 */
public interface ProApplicationPaymentMapper 
{
    /**
     * 查询付款申请单
     * 
     * @param aId 付款申请单ID
     * @return 付款申请单
     */
    public ProApplicationPayment selectProApplicationPaymentById(Long aId);

    /**
     * 查询付款申请单
     *
     * @param aStatus 付款申请单 申请状态
     * @return 付款申请单
     */
    public ProApplicationPayment selectProApplicationPaymentByIds(int aStatus);

    /**
     * 查询付款申请单列表
     * 
     * @param proApplicationPayment 付款申请单
     * @return 付款申请单集合
     */
    public List<ProApplicationPayment> selectProApplicationPaymentList(ProApplicationPayment proApplicationPayment);

    /**
     * 查询项目下对应的付款申请单
     */
    @Select("select * from pro_application_payment where p_id = #{pId}")
    @ResultMap("ProApplicationPaymentResult")
    List<ProApplicationPayment> selectProjectContractlists(Long sId);

    /**
     * 新增付款申请单
     * 
     * @param proApplicationPayment 付款申请单
     * @return 结果
     */
    public int insertProApplicationPayment(ProApplicationPayment proApplicationPayment);

    /**
     * 修改付款申请单
     * 
     * @param proApplicationPayment 付款申请单
     * @return 结果
     */
    public int updateProApplicationPayment(ProApplicationPayment proApplicationPayment);

    /**
     * 删除付款申请单
     * 
     * @param aId 付款申请单ID
     * @return 结果
     */
    public int deleteProApplicationPaymentById(Long aId);

    /**
     * 批量删除付款申请单
     * 
     * @param aIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteProApplicationPaymentByIds(String[] aIds);

    /**
     * 导出所有
     *
     * @param proApplicationPayment 用户信息
     * @return 用户信息集合信息
     */
    public List<ProApplicationPayment> selectUserexport(ProApplicationPayment proApplicationPayment);

    /**
     * 提交申请财务可见
     */
    @Update("update pro_application_payment set a_status =1  where a_id = #{aId}")
    @ResultMap("ProApplicationPaymentResult")
    int finExaStatus(Long aId);

    /**
     * 提交通过申请总经理可见
     */
    @Update("update pro_application_payment set a_status =2  where a_id = #{aId}")
    @ResultMap("ProApplicationPaymentResult")
    int finExaStatuss(Long aId);

    /**
     * 驳回请假
     */
    @Update("update pro_application_payment set a_status =4  where a_id = #{aId}")
    @ResultMap("ProApplicationPaymentResult")
    int editparoStatus(Long aId);

    /**
     * 撤销申请
     */
    @Update("update pro_application_payment set a_status =0  where a_id = #{aId}")
    @ResultMap("ProApplicationPaymentResult")
    int revoExaStatus(Long aId);

    /**
     * 总经理通过申请
     */
    @Update("update pro_application_payment set a_status =3  where a_id = #{aId}")
    @ResultMap("ProApplicationPaymentResult")
    int fExaStatus(Long aId);


    /**
     * 撤销申请
     */
    @Update("update pro_application_payment set a_status =5  where a_id = #{aId}")
    @ResultMap("ProApplicationPaymentResult")
    int over(Long aId);


    /**
     *
     * 查询总项目下状态为结束的付款申请单
     */
    List<ProApplicationPayment> selectProjectContractlistsid(@Param("sId") Long sId, @Param("id") Long id);
}
